<fieldset class="fieldset display file"
	id="{{unbound uid}}-fieldset"
>	
	<input type="hidden" class="formKey {{validClass valid}}" {{validAttr valid}} 
		name="{{unbound type}}@{{unbound name}}@{{unbound indexx}}@{{unbound uid}}"
	/>

	<div class="legend">
		{{name}}
		<span {{bindAttr class=":req valid.func_not_empty:required:hide"}}>*</span></div>
	</div>
	<div class="fileInput">
		<span class="btn btn-success fileinput-button" style="float: none;">
	        <i class="icon-plus icon-white"></i>
	        <span>Select files...</span>
	        <!-- The file input field used as target for the file upload widget -->
	        <input id="fileupload" type="file" name="files[]" multiple="" class="file">
	    </span>
	    
	    <div id="files"></div>
		
		<script src="script/upload/jquery.ui.widget.js"></script>
		<script src="script/upload/jquery.iframe-transport.js"></script>
		<script src="script/upload/jquery.fileupload.js"></script>
		
		<script>
			/*jslint unparam: true */
			/*global window, $ */
			$(function () {
			    'use strict';
			    // Change this to the location of your server-side upload handler:
			    var url = '/palmio/upload';
			    $('#fileupload').fileupload({
			        url: url,
			        dataType: 'json',
			        done: function (e, data) {
			            $.each(data.result.files, function (index, file) {
			                $('<div class="icon-ok"></div>').text("  "+file.name).appendTo('#files');
			                $('<br/>').appendTo('#files');
			                
			                var v = $('#hide').val();
			                if (v != "") {
			                	v += ",";
			                }
			                $('#hide').val(v + file.name)
			            });
			        }
			    });
			});
		</script>
	</div>
</fieldset>